package com.confinderence;

import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.confinderence.model.Lecture;

public class LectureDetailsFragment extends Fragment {
	private Lecture mLecture;
	private TextView mTitle;
	private TextView mDescription;
	private TextView mLecturer;
	private TextView mDate;
	private TextView mTime;
	private TextView mDuration;
	public LectureDetailsFragment(Lecture lecture) {
		mLecture = lecture;
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_conference_lecture_page, container,
				false);
		init(rootView);
		return rootView;
	}
	private void init(View view) {
		mTitle = (TextView) view.findViewById(R.id.lectureTitle);
		mDescription = (TextView) view.findViewById(R.id.lectureDescription);
		mLecturer = (TextView) view.findViewById(R.id.lectureLecturer);
		mDate = (TextView) view.findViewById(R.id.lectureCreated);
		mTime = (TextView) view.findViewById(R.id.lectureTime);
		mDuration = (TextView) view.findViewById(R.id.lectureDuration);

		String lectureTitle = mLecture.getTitle();
		String lecturerName = getActivity().getString(R.string.lecturer_label)
				+ mLecture.getLecturer().getName();
		String description = getActivity().getString(R.string.description_label)
				+ mLecture.getDescription();
		String date = getActivity().getString(R.string.date_label) + mLecture.getDate().toString();
		String time = getActivity().getString(R.string.time_label) + mLecture.getTime().toString();
		String duration = getActivity().getString(R.string.duration_label) + mLecture.getLength();

		mTitle.setText(lectureTitle);
		mDescription.setText(description);
		mLecturer.setText(lecturerName);
		mDate.setText(date);
		mTime.setText(time);
		mDuration.setText(duration);
	}
}